-
Notifications
You must be signed in to change notification settings - Fork 0
[CORRUPTED] Synthetic Benchmark PR #36132 - FIX: silent failure when watched words contains invalid regex #8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: base_pr_36132_20251204_3908
Are you sure you want to change the base?
Conversation
If a watched words list contains any invalid regex, the test modal won't work because the "compiled" regex (that contains all the watched words) will be invalid. This PR introduces a fallback to matching individual watched words when the compiled regex is invalid as well as displaying the error for each invalid regex. Internal ref - t/168206
PR Compliance Guide 🔍Below is a summary of compliance checks for this PR:
Compliance status legend🟢 - Fully Compliant🟡 - Partial Compliant 🔴 - Not Compliant ⚪ - Requires Further Human Verification 🏷️ - Compliance label |
|||||||||||||||||||||||||
PR Code Suggestions ✨Explore these optional code suggestions:
|
|||||||||
User description
Benchmark PR discourse#36132
Type: Corrupted (contains bugs)
Original PR Title: FIX: silent failure when watched words contains invalid regex
Original PR Description: If a watched words list contains any invalid regex, the test modal won't work because the "compiled" regex (that contains all the watched words) will be invalid.
This PR introduces a fallback to matching individual watched words when the compiled regex is invalid as well as displaying the error for each invalid regex.
Screen.Recording.2025-11-20.at.10.34.05.mov
Internal ref - t/168206
Original PR URL: discourse#36132
PR Type
Bug fix, Enhancement, Tests
Description
Handle invalid regex in watched words gracefully with fallback matching
Display individual regex errors instead of silent failures
Improve test modal to work with mixed valid/invalid regex patterns
Add comprehensive test coverage for invalid regex scenarios
Diagram Walkthrough
flowchart LR A["Invalid Regex Detection"] --> B["Log Warning & Skip Invalid"] B --> C["Fallback to Individual Words"] C --> D["Display Error Details"] E["Test Modal"] --> F["Try Compiled Expression"] F --> G{Compilation Failed?} G -->|Yes| C G -->|No| H["Show Matches"]File Walkthrough
word_watcher.rb
Add error handling and fallback for invalid regexapp/services/word_watcher.rb
compilation
word_watcher_spec.rb
Add tests for invalid regex handlingspec/services/word_watcher_spec.rb
present
admin-watched-words-test.js
Add acceptance tests for invalid regex scenariosfrontend/discourse/tests/acceptance/admin-watched-words-test.js
action.js
Refactor to handle multiple regex errorsfrontend/discourse/admin/controllers/admin-watched-words/action.js
regexpErrortoregexpErrorsarray for multipleerrors
@cacheddecorator for performance optimizationstaff_logs.scss
Add styling for regex error displayapp/assets/stylesheets/admin/staff_logs.scss
.watched-word-regex-errorsclass for error list stylingwatched-word-testing.gjs
Add error handling and fallback in test modalfrontend/discourse/admin/components/modal/watched-word-testing.gjs
matchesgetter tomatchesAndErrorsreturning both matchesand errors
modal
expression fails
action.gjs
Update template to display multiple errorsfrontend/discourse/admin/templates/admin-watched-words/action.gjs
.watched-word-regex-errorsstyling classclient.en.yml
Add i18n key for multiple errorsconfig/locales/client.en.yml
invalid_regex_multiplefor multiple error header